package com.suixuan.support.util.json;

import java.io.Serializable;

import flexjson.JSONSerializer;

/**
 * 
 * 
 * Nanjing Zhou Su co.,Ltd
 * 
 * @Title: JsonUtils.java
 * @Package: com.suixuan.spring.util.web
 * @Description: 对象转换JSON
 * @Author: 束剑
 * @Date 2010-3-15 上午11:56:01
 * @Version V1.0
 * 
 */
public final class JsonUtils {
	private JsonUtils() {
	};

	private static JSONSerializer jsonSerializer = new JSONSerializer();

	/**
	 * 将对象转换成Json字符串
	 * 
	 * @param obj
	 *            Object
	 * @return Json字符串
	 */
	public static String objToJson(Serializable obj, String... exclude) {
		String[] ex = new String[exclude.length + 1];
		ex[0] = "*.class";
		System.arraycopy(exclude, 0, ex, 1, exclude.length);
		return jsonSerializer.exclude(ex).include("*").serialize(obj);
	}

}
